package org.guanmi.btc.browser.contants;

public enum BtcBrowserCodeConstant {
	/**
	 * 系统/操作
	 */
	SUCCESS(1000, "操作成功"),
	FAIL(1001, "操作失败"),
	SYSTEM_SIGN_ERROR(1002, "签名有误"),
	ERROR_PARAM(1003, "参数有误"),
	JSON_READ_ERROR(1004,"JSON格式数据解释失败"),
	SYSTEM_ERROR(1005,"系统异常"),
	ILLEGAL_REQUEST_PARAMETER_EXCEPTION(1006,"参数异常");

	/**
	 * 错误码
	 */
	public int code;

	/**
	 * 错误信息
	 */
	public String msg;

	private BtcBrowserCodeConstant(int code, String msg) {
		this.code = code;
		this.msg = msg;
	}

	// 普通方法
	public static String getMsg(int code) {
		for (BtcBrowserCodeConstant c : BtcBrowserCodeConstant.values()) {
			if (c.getCode() == code) {
				return c.msg;
			}
		}
		return null;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

}
